﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ue.Extensions;

namespace Ue.Tests.Utilities
{
    /// <summary>
    /// CodeTimer 的摘要说明
    /// </summary>
    [TestClass]
    public class CodeTimerTests
    {
        [TestMethod]
        public void CodeTimer()
        {
            var iteration = 100 * 1000;
            string s = "1";
       
            Ue.Utility.CodeTimer.Initialize();
            Ue.Utility.CodeTimer.Time("1", iteration, () => {s.As<int>(); });
            
            Ue.Utility.CodeTimer.Initialize();
            Ue.Utility.CodeTimer.Time("2", iteration, () => { s.As(typeof(int), () => 1); });

            Ue.Utility.CodeTimer.Initialize();
            Ue.Utility.CodeTimer.Time("3", iteration, () => { Convert.ChangeType(s,typeof(int)); });

            Ue.Utility.CodeTimer.Initialize();
            Ue.Utility.CodeTimer.Time("3", iteration, () => { int.Parse(s); });
        }

    }
}
